def make_basis(fp):
    import GlobalParam
    gp=GlobalParam.iparam

    lat=gp.get_struct()

    # Set basis of the smallest unit cell
    if lat=="bcc":
        gp.add_basis(0.0,0.0,0.0)
        gp.add_basis(0.5,0.5,0.5)
    elif lat=="fcc":
        gp.add_basis(0.0,0.0,0.0)
        gp.add_basis(0.5,0.5,0.0)
        gp.add_basis(0.0,0.5,0.5)
        gp.add_basis(0.5,0.0,0.5)
    else:
        print("Not prepared for this lattice structure: %s\n" % lat)
        raise Exception

    # Set basis position with actual length unit
    for i in range(gp.get_nbasis()):
        px=gp.get_basis_pos(i)[0]*gp.get_lattice_param()
        py=gp.get_basis_pos(i)[1]*gp.get_lattice_param()
        pz=gp.get_basis_pos(i)[2]*gp.get_lattice_param()
        gp.add_basis2(px,py,pz)
        
    # Set layer to be removed
    for i in range(gp.get_ignore_layer()):
        gp.set_rlayer(i)

    # Set unitcell to save the counting
    gp.set_unitcell()
